package com.noyes4j.encrypt.crypto;

import com.noyes4j.encrypt.Crypto;
import com.noyes4j.encrypt.symmetric.AesCrypto;
import com.noyes4j.encrypt.symmetric.DesCrypto;
import com.noyes4j.encrypt.symmetric.UrlCrypto;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Request-Response加解密体系的加解密方式
 * @author zhaoweiqin
 */
@Configuration
public class RRCryptoConfig {
    /**
     * 加密解密方式使用一样的
     */
    @Bean("rrCrypto")
    public Crypto rrCrypto(){
        return new AesCrypto("dsfsdgwaregw");
    }

    public static void main(String[] args) {


        Crypto crypto = new AesCrypto("dsfsdgwaregw");
        System.out.println(crypto.encrypt("赵伟钦"));
        //System.out.println(crypto.decrypt("53HfmLx7E6USDlpvku1b2Q=="));


   /*     UrlCrypto ul=new UrlCrypto();
        System.out.println(ul.encrypt("赵伟钦"));
        System.out.println(ul.decrypt("%E8%B5%B5%E4%BC%9F%E9%92%A6"));*/


        DesCrypto dc=new DesCrypto("dsfsdgwaregw");
        System.out.println(dc.encrypt("赵伟钦"));
    }
}